﻿namespace SampleApplication.CoffeeShopSample.Implementation.Application.CommandsParsers
{
    #region Usings

    using Dependencies.Application;
    using Domain;
    using System;

    #endregion Usings

    public class OrderCoffeeCommandParser : ICommandParser
    {
        private readonly MakeCoffeeCommand makeCoffeeCommand;

        public OrderCoffeeCommandParser(MakeCoffeeCommand makeCoffeeCommand)
        {
            if (makeCoffeeCommand == null)
            {
                throw new ArgumentNullException("makeCoffeeCommand");
            }

            this.makeCoffeeCommand = makeCoffeeCommand;
        }

        public ICommand Parse(string command)
        {
            return "1".Equals(command) ? makeCoffeeCommand : null;
        }
    }
}